<template>
  <view>
    <uni-popup ref="popup" type="center">
      <view class="app-infos">
        <view class="title-wrap">
          <view class="title-left">
            <image class="title-logo" src="/static/logo.ico" mode="aspectFit"></image>
            <text class="title-text">{{appName}}</text>
          </view>
          <view class="title-right">
            <text class="icon-btn" @click="close">{{'\ue723'}}</text>
          </view>
        </view>
        <view class="info-wrap">
          <view class="app-name">{{appName}}</view>
          <view class="app-version">{{'v'+version}}</view>
        </view>
      </view>
      
    </uni-popup>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        appName: getApp().globalData.appName, 
        version: '',
      }
    },
    methods: {
      open() {
        var self = this
        window?.api?.getVersion((ver)=>{
          self.version = ver 
          self.$refs.popup.open()
          console.log('=== app 版本: ', ver)
        })
      },
      close() {
        this.$refs.popup.close() 
      }
    }
  }
</script>

<style scoped>
@font-face {
  font-family: "iconfont";
  src: url('@/static/font/iconfont.ttf');
}
.about-wrap {
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0;
  bottom: 0; 
  z-index: 100;
  
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.app-infos {
  width: 250px;
  height: 125px;
}
.title-wrap {
  border-radius: 4px 4px 0 0;
  height: 30px;
  padding: 0 6px;
  box-sizing: border-box;
  
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background-color: #fff;
}
.title-left {
  display: flex;
  flex-direction: row;
  align-items: center;
}
.title-right {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
.title-logo {
  width: 14px;
  height: 14px;
}
.title-text {
  font-size: 14px;
  color: #333;
  margin-left: 4px;
}
.icon-btn {
  font-family: "iconfont";
  font-size: 16px;
  color: #333;
  padding-left: 10px;
}
.info-wrap {
  padding: 20px 6px 30px 6px;
  border-radius: 0 0 4px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
}
.app-name {
  font-size: 16px;
  font-weight: bold;
  line-height: 30px;
  color: #333;
}
.app-version {
  font-size: 14px;
  color: #333;
}

</style>